import Dao from "../../../../utils/dao";
import {MyMap} from "../../../../utils/lodash";

export async function getbestSales(options, {limit, offset}) {
    var designDao = new Dao("design")
    /*designSalesCount  sort   designId: "", salesCount: 0,
    * designItem objectId
    *
    * */
    var result = await designDao.select(options).limit(limit).skip(offset)
    return result
}


export async function getnew(options, {limit, offset}) {
    /*designSalesCount  sort   designId: "", salesCount: 0,
    * designItem objectId
    *
    * */
    var query = new AV.Query('design');
    var result = await   query.descending('createdAt').limit(limit).skip(offset).find()
    return MyMap(result, (item) => {
        return item.toJSON()
    })
}